<template>
	<view :class="[$store.state.AppStyle, isDark?'dark':'']" v-if="tabCurTab==isLogin"  :style="{'background-color':isDark?'#1c1c1c':'#f6f6f6','min-height':isDark?'100vh':'auto'}">
		<view class="header" :style="[{height:CustomBar + 'px'}]">
			<view class="cu-bar bg-white" :style="{'height': CustomBar + 'px','padding-top':StatusBar + 'px'}"
				v-if="tabCurTab==isLogin">
				<view class="forumHome-header" style="margin-left: 34upx;">
					<!-- 配置化功能导航 -->
					<text 
						v-for="(feature, index) in availableFeatures" 
						:key="feature.key"
						class="square-box" 
						:class="currentFeatureKey === feature.key ? 'cur' : ''" 
						@tap="switchToFeature(feature.key)">
						{{feature.displayName}}
					</text>
				</view>
				<!-- #ifdef APP-PLUS || H5 -->
				<view class="user-rz">
					<tn-avatar style="margin-right: 34upx;" badgeBgColor="#ff4f4f" :src="avatarurl" :badge="noticeSumof"
						:badgeText="noticeSum" v-if="token!=''&&tabCurTab==isLogin"
						@tap="goMsg()"></tn-avatar>
					<tn-avatar style="margin-right: 34upx;font-size: 24upx;" :backgroundColor="isDark?'#3c3c3c':'#f5f5f5'" text="$t('common.login')" v-else
						@tap="goUserInfo()"></tn-avatar>
					<image class="user-rz-icon-htop" style="margin-right: 34upx;" :src="rzImg"
						v-if="token!=''&&identifyCompany==1&&tabCurTab==isLogin" mode="aspectFill"></image>
				</view>
				<!-- #endif -->
				<!-- #ifdef MP -->
				<view class="action">
				</view>
				<!-- #endif -->
			</view>
		</view>
		<view :style="[{padding:CustomBar +  'px 10px 0px 10px'}]" style="background: #ffffff;"></view>
		
		<!-- 广场start -->
		<block v-if="squareid==5&&tabCurTab==isLogin">

			<view :class="{'data-box-2-banner': homeStyle==2}" style="padding: 0 15rpx;" :style="[{background:isDark?'#121212':'#ffffff'}]">
				<tn-swiper v-if="Bannerswitch==1&&adimage_sl!=0" :list="swiperList2" :effect3d="swiperStyle"
					:class="swiperStyle?'':'uni-swiper-slides-1'" style="padding: 0;" @click="swiperclick"
					:height="swiperHeight" :effect3dPreviousSpacing="80"></tn-swiper>
			</view>
			<view class="bg-white padding-top-sm" :class="{'data-box-2': homeStyle==2}">
				<view class="icon-grid"  v-if="Hyperlinks==1&&tabCurTab==isLogin">
					<view class="icon-item tn-radius" v-for="(item, index) in iconimg"
						:key="index" @tap="toLink(item.link,item.lgof)">
						<view class="tn-flex tn-flex-direction-column tn-flex-row-center tn-flex-col-center">
							<view class="icon5__item--icon tn-flex tn-flex-row-center tn-flex-col-center tn-shadow-blur"
								:style="'background-image: url(' + item.url + ')'" style="background-size:100% 100%;">
							</view>
							<view class="tn-text-center text-bold">
								<text class="tn-text-ellipsis">{{item.name}}</text>
							</view>
						</view>
					</view>
				</view>
			</view>

			<!-- 最近活跃 -->
			<view class="data-box" :class="{'data-box-2': homeStyle==2}" v-if="Gallery==1&&tabCurTab==isLogin">
				<view class="cu-bar bg-white">
					<view class="action data-box-title">
						<text class="cuIcon-titles text-rule"></text>{{$t('tabpage.find.recentlyactive')}}
					</view>
					<view class="action more" @tap="toUserList()">
						<text>{{$t('tabpage.find.finduser')}}</text><text class="cuIcon-right"></text>
					</view>
				</view>
				<view class="active-users-container">
					<scroll-view scroll-x="true" class="active-users-scroll" show-scrollbar="false" v-if="userList.length > 0">
						<view class="active-users-list">
							<view class="active-user-card" v-for="(item,index) in userList" :key="index" @tap="toUserContents(item)">
								<view class="user-avatar-container">
									<view class="user-avatar" :style="item.style">
									</view>
									<image v-if="item.lvrz==1" class="user-rz-icon-active" :src="rzImg" mode="aspectFill"></image>
								</view>
								<view class="user-name" :class="item.isvip > 0 ? 'vip-name' : ''">
									<block v-if="item.screenName">{{item.screenName}}</block>
									<block v-else>{{item.name}}</block>
								</view>
								<view class="user-intro">
									{{subText(item.introduce, 20)}}
								</view>
							</view>
						</view>
					</scroll-view>
					<view class="no-active-users" v-else>
						<text class="cuIcon-people text-gray"></text>
						<text class="no-users-text">{{$t('tabpage.find.noactiveuser')}}</text>
					</view>
				</view>
				
			</view>

			<view class="data-box" :class="{'data-box-2': homeStyle==2}" v-if="Code==1&&tabCurTab==isLogin">
				<view class="cu-bar bg-white">
					<view class="action data-box-title">
						<text class="cuIcon-titles text-rule"></text>{{$t('tabpage.find.suggesttopic')}}
					</view>
					<view class="action more" @tap="toAlltag">
						<text>{{$t('tabpage.find.alltopic')}}</text><text class="cuIcon-right"></text>
					</view>
				</view>
				<view class="topic-cards-container">
					<view class="topic-row" v-for="(row, rowIndex) in topicRows" :key="rowIndex">
						<view class="topic-card" v-for="(item, index) in row" :key="index"
							@tap='toCategoryContents("#"+item.name,item.mid,"tag")'>
							<view class="topic-image-container">
								<image class="topic-image" :src="item.imgurl || '/static/page/pic.png'" mode="aspectFill"></image>
							</view>
							<view class="topic-content">
								<view class="topic-name">#{{item.name}}</view>
								<view class="topic-count" v-if="item.description">
									<text class="topic-count-text des-info">{{item.description}}</text>
								</view>
							</view>
						</view>
					</view>
				</view>
			</view>
			
			<view class="data-box" :class="{'data-box-2': homeStyle==2}" v-if="wzof==1&&Findtop==1&&tabCurTab==isLogin">
				<view class="cu-bar bg-white">
					<view class="action data-box-title">
						<text class="cuIcon-titles text-rule"></text>{{$t('tabpage.find.suggestarticle')}}
					</view>
					<view class="action more" @tap="toRecommend">
						<text>{{$t('global.all')}}</text><text class="cuIcon-right"></text>
					</view>
				</view>
				<view class="cu-card article no-card">
					<block v-for="(item,index) in recommendList" :key="index" v-if="actStyle==1&&tabCurTab==isLogin">
						<articleItemA :item="item" :isDark="isDark"></articleItemA>
					</block>
					<block v-for="(item,index) in recommendList" :key="index" v-if="actStyle==2&&tabCurTab==isLogin">
						<articleItemB :item="item" :isDark="isDark"></articleItemB>
					</block>
				</view>
			</view>
			<view class="data-box" :class="{'data-box-2': homeStyle==2}" v-if="shopof==1&&tabCurTab==isLogin">
				<view class="cu-bar bg-white">
					<view class="action data-box-title">
						<text class="cuIcon-titles text-rule"></text>{{$t('tabpage.find.bestseller')}}
					</view>
					<view class="action more" @tap="setSquare(4)">
						<text>{{$t('tabpage.find.entermall')}}</text><text class="cuIcon-right"></text>
					</view>
				</view>
				<view class="tn-flex tn-flex-wrap" style="margin: 0 15rpx;">
					<block v-for="(item,index) in shopList" :key="index">
						<shopItem :item="item" :isDark="isDark"></shopItem>
					</block>
				</view>
			</view>

			<view class="cu-bar bg-white margin-top-sm">
				<view class="action data-box-title">
					<text class="cuIcon-titles text-rule"></text>{{$t('tabpage.find.dynamichot')}}
				</view>
				<view class="action more" @tap="setSquare(1)">
					<text>{{$t('global.all')}}</text><text class="cuIcon-right"></text>
				</view>
			</view>
			<block v-if="spaceshowList.length==0">
				
				<block v-if="spaceshowLoad">
					<view class="no-data">
						<text class="cuIcon-text"></text>
						{{$t('tabpage.find.currnoupdate')}}
						<view class="text-center margin-top-sm">
							<text class="cu-btn bg-gradual-orange radius" @tap="postSpace(0)">{{$t('tabpage.find.publishnow')}}</text>
						</view>
					</view>
				</block>
				<block v-else>
					<view class="dataLoad" v-if="!dataLoad">
						<image src="../../static/loading.gif"></image>
					</view>
				</block>
			</block>
					
			<spaceItem :spaceList="spaceshowList" :curIMG="curIMG" :isDark="isDark"></spaceItem>
			<view style="width: 100%; height: 100upx;" :style="{'background-color':isDark?'#1c1c1c !important':'#f6f6f6'}" ></view>
			<view class="loading" v-if="isLoading==0">
				<view class="loading-main">
					<image src="../../static/loading.gif"></image>
				</view>
			</view>
		</block>
		<!-- 广场end -->
		
		<!-- 文章start -->
		<block v-if="squareid==3&&tabCurTab==isLogin">
			<metas :topic="metaList" :isDark="isDark">
			</metas>
			<view class="loading" v-if="isLoading==0">
				<view class="loading-main">
					<image src="../../static/loading.gif"></image>
				</view>
			</view>
			<view style="width: 100%; height: 100upx;" :style="{'background-color':isDark?'#1c1c1c !important':'#f6f6f6'}" ></view>
		</block>
		<!-- 文章end -->
		
		<!-- 商城start -->
		<block v-if="squareid==4&&tabCurTab==isLogin">
			<view class="data-box shop-operate" style="background-color: #f6f6f6;margin-top: 0rpx;">
				<view class="cu-bar bg-white search-bar" :style="{'background-color':isDark?'#2c2c2c !important':''}">
					<view class="search-form round" :style="{'background-color':isDark?'#2c2c2c !important':''}">
						<text class="cuIcon-search"></text>
						<input type="text" placeholder="$t('tabpage.find.searchgoods')" v-model="shopSearchText" @input="shopSearchShop"/>
					</view>
					<view class="filter-btn" @tap="showShopFilter">
						<text class="cuIcon-filter text-gray"></text>
						<text class="filter-text">{{$t('tabpage.find.filter')}}</text>
					</view>
				</view>
			</view>
			<view class="data-box" style="background-color: #f6f6f6;">
				<view class="no-data" v-if="shopList.length==0">
					{{$t('global.noproduct')}}
				</view>
				<view class="shop-list">
					<view class="tn-flex tn-flex-wrap">
						<block v-for="(item,index) in shopList" :key="index">
							<shopItem :item="item" :isDark="isDark"></shopItem>
						</block>
					</view>
				</view>
			</view>
			<view class="load-more" @tap="shopLoadMore" v-if="shopList.length>0">
				<text>{{shopMoreText}}</text>
			</view>
			<!--加载遮罩-->
			<view class="loading" v-if="shopIsLoading==0">
				<view class="loading-main">
					<image src="../../static/loading.gif"></image>
				</view>
			</view>
			<!--加载遮罩结束-->
			
			<!-- 商城筛选选择器 -->
			<tn-popup v-model="shopFilterShow" mode="bottom" :mask-close-able="true" :safe-area-inset-bottom="true">
				<view class="shop-filter-popup">
					<view class="filter-header">
						<view class="filter-title">{{$t('tabpage.find.productfilter')}}</view>
						<view class="filter-reset" @tap="resetShopFilter">{{$t('common.reset')}}</view>
					</view>
					
					<view class="filter-section">
						<view class="filter-section-title">{{$t('tabpage.find.goodcategory')}}</view>
						<view class="filter-options">
							<view class="filter-option" :class="{'active': tempShopSort === 0}" @tap="selectTempShopSort(0)">
								{{$t('global.allcategory')}}
							</view>
							<view class="filter-option" 
								v-for="(item,index) in shopSortList" 
								:key="index"
								:class="{'active': tempShopSort === item.id}" 
								:title="item.name"
								@tap="selectTempShopSort(item.id, item.name)">
								{{item.name}}
							</view>
						</view>
					</view>
					
					<!-- 当未选择大类时显示提示 -->
					<view class="filter-section" v-if="tempShopSort === 0 && shopSortList.length > 0">
						<view class="filter-tip">
							<text class="cuIcon-info text-gray"></text>
							<text class="filter-tip-text">{{$t('tabpage.find.plsselbigcategory')}}</text>
						</view>
					</view>
					
					<view class="filter-section" v-if="tempShopSort > 0 && tempShopSubtypeList.length > 0">
						<view class="filter-section-title">{{$t('tabpage.find.subcategory')}}</view>
						<view class="filter-options">
							<view class="filter-option" :class="{'active': tempShopSubtype === 0}" @tap="selectTempShopSubtype(0)">
								{{$t('tabpage.find.allsubcategory')}}
							</view>
							<view class="filter-option" 
								v-for="(item,index) in tempShopSubtypeList" 
								:key="index"
								:class="{'active': tempShopSubtype === item.id}" 
								:title="item.name"
								@tap="selectTempShopSubtype(item.id, item.name)">
								{{item.name}}
							</view>
						</view>
					</view>
					
					<view class="filter-footer">
						<view class="filter-btn-cancel" @tap="cancelShopFilter">{{$t('common.cancel')}}</view>
						<view class="filter-btn-confirm" @tap="confirmShopFilter">{{$t('common.sure')}}</view>
					</view>
				</view>
			</tn-popup>
			<view style="width: 100%; height: 100upx;" :style="{'background-color':isDark?'#1c1c1c !important':'#f6f6f6'}" ></view>
		</block>
		<!-- 商城end -->
		
		<!-- 圈子start -->
		<block v-if="squareid==0&&tabCurTab==isLogin">
			<forumIndex :sectionList="sectionList" :swiperList="swiperList" :radiusStyle="radiusStyle"
				:radiusBoxStyle="radiusBoxStyle" :fatherTitle="fatherTitle" :swiperStyle="swiperStyle"
				:swiperType="swiperType" :recommendSectionList="recommendSectionList" :recommendOf="recommendOf"
				:kuaijie="kuaijie" :isDark="isDark">
			</forumIndex>
			<view class="loading" v-if="isLoading==0">
				<view class="loading-main">
					<image src="../../static/loading.gif"></image>
				</view>
			</view>
			<view style="width: 100%; height: 100upx;" :style="{'background-color':isDark?'#1c1c1c !important':'#f6f6f6'}" ></view>
		</block>
		<!-- 圈子start -->
		
		<!-- 动态start -->
		<block v-if="squareid==1&&tabCurTab==isLogin">
			<view class="data-box" :class="{'data-box-2': homeStyle==2}">
				
				<view class="square-post">
					<view class="square-post-header">
						<view class="square-user" @tap="goUserInfo()">
							<tn-avatar :src="avatarurl" v-if="token!=''"></tn-avatar>
							<tn-avatar style="font-size: 20upx;" :backgroundColor="isDark?'#2c2c2c':'#f5f5f5'" text="登录" v-else
								@tap="goUserInfo()"></tn-avatar>
						</view>
						<view class="square-text" @tap="postSpace(0)">
							{{$t('tabpage.find.sharelife')}}
						</view>
					</view>
					<view class="square-post-btn grid col-2">
						<view class="square-post-btn-box" @tap="postSpace(0)">
							<text class="cuIcon-pic"></text>{{$t('tabpage.find.textdynamic')}}
						</view>
						<view class="square-post-btn-box" @tap="postSpace(4)">
							<text class="cuIcon-record"></text>{{$t('global.videoupdate')}}
						</view>
					</view>
				</view>
			</view>
			<view class="cu-bar bg-white margin-top-sm">
				<view class="action data-box-title">
					<text class="cuIcon-titles text-rule"></text>{{$t('tabpage.find.allupdate')}}
				</view>
				<!-- 下拉选择排序 -->
				<view class="square-data-type-picker">
					<view class="filter-item" @tap="openSpaceTypePicker">
						<text>{{spaceTypeText}}</text>
						<text class="cuIcon-unfold"></text>
					</view>
					<u-picker v-model="showSpaceTypePicker" :show="showSpaceTypePicker" :columns="[spaceTypeOptions]" @confirm="confirmSpaceType" @cancel="showSpaceTypePicker=false" mode="selector" :range="spaceTypeOptions" range-key="label"></u-picker>
				</view>
			</view>
			<block v-if="spaceList.length==0">

				<block v-if="spaceLoad">
					<view class="no-data">
						<text class="cuIcon-text"></text>
						{{$t('tabpage.find.currnoupdate')}}
						<view class="text-center margin-top-sm">
							<text class="cu-btn bg-gradual-orange radius" @tap="postSpace(0)">{{$t('tabpage.find.publishnow')}}</text>
						</view>
					</view>
				</block>
				<block v-else>
					<view class="dataLoad" v-if="!dataLoad">
						<image src="../../static/loading.gif"></image>
					</view>
				</block>
			</block>
			<spaceItem :spaceList="spaceList" :curIMG="curIMG" :isDark="isDark"></spaceItem>
			<view class="load-more" @tap="loadMore" v-if="dataLoad&&spaceList.length>0">
				<text>{{moreText}}</text>
			</view>
			<view style="width: 100%; height: 100upx;" :style="{'background-color':isDark?'#1c1c1c !important':'#f6f6f6'}" ></view>
			<!--加载遮罩-->
			<view class="loading" v-if="isLoading==0">
				<view class="loading-main">
					<image src="../../static/loading.gif"></image>
				</view>
			</view>
			<!--加载遮罩结束-->
		</block>
		<!-- 动态end -->
		
		
		<!-- 应用start -->
		<block v-if="squareid==2&&tabCurTab==isLogin">
			<!-- #ifdef APP-PLUS || H5 -->
			<block v-if="appLoad">
				<!-- 应用列表部分 -->
				<view class="u-wrap" :style="{ height: `calc(100vh - ${NavBar+10}px)` }">
					<view class="u-menu-wrap">
						<!-- 左侧菜单保持不变 -->
						<scroll-view scroll-y scroll-with-animation class="u-tab-view menu-scroll-view"
							:scroll-top="scrollTop">
							<view v-for="(item,index) in tabbar" :key="index" class="u-tab-item"
								:class="[current==index ? 'u-tab-item-active' : '']" :data-current="index"
								@tap.stop="swichMenu(index)">
								<text class="u-line-1">{{item.name}}</text>
							</view>
							<view style="width: 100%; height: 120upx;" :style="{'background-color':isDark?'#1c1c1c !important':'#fff'}" ></view>
						</scroll-view>

						<!-- 右侧内容区只需要一个scroll-view -->
						<scroll-view scroll-y class="right-box"
							@scrolltolower="handleScrollToLower">
							<view class="page-view">
								<view class="class-item">
									<view class="filter-bar">
										<!-- 排序选择 -->
										<view class="filter-item" @tap="showOrderPicker">
											<text>{{orderText}}</text>
											<text class="cuIcon-unfold"></text>
										</view>

										<!-- 系统筛选 -->
										<view class="filter-item" @tap="showSystemFilter">
											<text>{{systemText}}</text>
											<text class="cuIcon-unfold"></text>
										</view>

										<!-- 类型筛选 -->
										<view class="filter-item" @tap="showTypeFilter">
											<text>{{$typeText}}</text>
											<text class="cuIcon-unfold"></text>
										</view>
									</view>

									<!-- 添加加载动画 -->
									<view class="loading-container" v-if="loading">
										<u-loading mode="circle" size="36"></u-loading>
									</view>

									<view class="item-container" v-else>
										<block v-if="appList.length>0">
											<view class="app-box" style="padding: 10rpx 10rpx 0 10rpx;"
												v-for="(item, index) in appList" :key="index">
												<view class="app-box-body" @tap="toAppInfo(item.id)">
													<view class="app-box-logo">
														<u-image :src="item.logo" width="110rpx" height="110rpx"
															mode="aspectFill" :lazy-load="true" :fade="true"
															duration="450" border-radius="28rpx">
															<u-loading slot="loading"></u-loading>
														</u-image>
													</view>
													<view class="app-box-content">
														<view class="app-box-title text-cut">{{item.name}}</view>
														<view class="app-box-info">
															<text :style="{color: item.tagInfo.color}"
																:class="item.score>=3?'tn-icon-star-fill':'tn-icon-star'"></text>
															<text
																:style="{color: item.tagInfo.color}">{{item.score}}</text>
															<text>{{item.size}}</text>

														</view>
														<view class="app-box-tags">
															<text class="app-tag"
																:style="{backgroundColor: item.tagInfo.color}">{{item.tagInfo.text}}</text>
															<text>v{{item.version}}</text>
															<text
																:class="item.system=='ios'?'tn-icon-iphone':''"></text>
														</view>
													</view>
												</view>
												<view class="app-box-down" @tap="toAppInfo(item.id)">{{$t('common.download')}}</view>
											</view>
										</block>
										<block v-else>
											<view class="margin-top-sm">
												<u-empty text="$t('global.nodata')" mode="data" icon-size="100"
													font-size="24"></u-empty>
											</view>

										</block>
										<!-- 底部加载更多 -->
										<view class="loading-more" v-if="loadStatus !== 'nomore'">
											<u-loadmore :status="loadStatus" :icon-type="'circle'"
												:load-text="loadMoreText" @loadmore="handleScrollToLower" />
										</view>
									</view>
								</view>
							</view>
							<view style="width: 100%; height: 120upx;" :style="{'background-color':isDark?'#1c1c1c !important':'#fff'}" ></view>
						</scroll-view>
					</view>
				</view>
			</block>
			<block v-else>
				<view class="dataLoad" v-if="!dataLoad">
					<image src="../../static/loading.gif"></image>
				</view>
			</block>
			<!-- 修改排序选择器 -->
			<u-picker v-model="showOrder" :show="showOrder" :columns="[orderOptions]" @confirm="confirmOrder"
				@cancel="cancelOrder" mode="selector" :range="orderOptions" range-key="text"></u-picker>

			<!-- 系统筛选弹窗 -->
			<u-popup v-model="showSystem" mode="bottom" :mask-close-able="true" :safe-area-inset-bottom="true"
				@close="showSystem = false">
				<view class="filter-popup">
					<view class="filter-title">{{$t('global.selectsystem')}}</view>
					<view class="filter-options">
						<view class="filter-option" v-for="(sys, index) in systemOptions" :key="index"
							:class="{'active': selectedSystem === sys.value}" @tap="selectSystem(sys.value)">
							{{sys.label}}
						</view>
					</view>
					<view class="filter-buttons">
						<view class="btn-reset" @tap="resetSystem">{{$t('common.reset')}}</view>
						<view class="btn-confirm" @tap="confirmSystem">{{$t('common.sure')}}</view>
					</view>
				</view>
			</u-popup>

			<!-- 类型筛选弹窗 -->
			<u-popup v-model="showType" mode="bottom" :mask-close-able="true" :safe-area-inset-bottom="true"
				@close="showType = false">
				<view class="filter-popup">
					<view class="filter-title">{{$t('global.selecttype')}}</view>
					<view class="filter-options">
						<view class="filter-option" v-for="(type, index) in typeOptions" :key="index"
							:class="{'active': selectedType === type.value}" @tap="selectType(type.value)">
							{{$type.label}}
						</view>
					</view>
					<view class="filter-buttons">
						<view class="btn-reset" @tap="resetType">{{$t('common.reset')}}</view>
						<view class="btn-confirm" @tap="confirmType">{{$t('common.sure')}}</view>
					</view>
				</view>
			</u-popup>
			<!-- #endif -->
		</block>
		<!-- 应用end -->
		<!--加载遮罩结束-->
		<view class="full-noLogin" v-if="noLogin">
			<view class="full-noLogin-main">
				<view class="full-noLogin-text">
					{{$t('global.loginafterview')}}
				</view>
				<view class="full-noLogin-btn">
					<view class="cu-btn bg-blue" @tap="goLogin()">
						{{$t('global.loginnow')}}
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import waves from '@/components/xxley-waves/waves.vue';
	import { getFindPageFeatures, getDefaultFindFeature } from '@/utils/pageConfig.js';
	import darkModeMixin from '@/utils/darkModeMixin.js';

	import {
		localStorage
	} from '../../js_sdk/mp-storage/mp-storage/index.js'
	export default {
		props: {
			curPage: {
				type: Number,
				default: 0
			},
			isDark:{
				type: Boolean,
				default: false
			}
		},
		name: "find",
		mixins: [darkModeMixin],
		data() {
			return {
				StatusBar: this.StatusBar,
				CustomBar: this.CustomBar+15,
				NavBar: this.StatusBar + this.CustomBar,
				AppStyle: this.$store.state.AppStyle,
				tabbar: [],
				scrollTop: 0, //tab标题的滚动条位置
				current: 0, // 预设当前项的值
				menuHeight: 0, // 左边菜单的高度
				menuItemHeight: 0, // 左边菜单item的高度
				sectionList: [],
				page: 1,
				moreText: $t('common.loadmoretxt'),
				swiperList: [],
				submitStatus5: false,
				submitStatus3: false,
				submitStatus2: false,
				submitStatus1: false,
				squareid: 5,
				isLogin: 1,
				metaList: [],
				adimage_sl: 0,
				tagList: [],
				recommendList: [],
				shopList: [],
				rzImg: this.$API.SPRz(),
				Rz: false,
				isvip: 0,
				userList: [],
				tabCurTab: 1,
				spaceDataType: 2,
				uid: 0,
				homeStyle: 1,
				swiperHeight: this.$API.SPfindSwiperHeight(),
				swiperBgcolor: "",
				actStyle: 0,
				Hyperlinks: 0,
				Gallery: 0,
				Findtop: 0,
				Code: 0,
				isLoading: 0,
				kuaijie: 2,
				radiusBoxStyle: 0,
				radiusStyle: 0,
				fatherTitle: 2,
				swiperStyle: false,
				swiperType: 0,
				recommendOf: 0,
				ads: "",
				wzof: 0,
				tzof: 0,
				shopof: 0,
				Bannerswitch: 0,
				searchText: "",
				iconimg: [],
				avatarurl: "../../static/user/avatar.png",
				dataLoad: false,
				spaceLoad: false,
				spaceshowLoad: false,
				appLoad: false,
				recommendSectionList: [],
				swiperList2: [],
				chatList: [],
				oldChatList: [],
				identifyCompany: 0,
				curIMG: "",
				bannerAds: [],
				bannerAdsInfo: null,
				noticeSumof: false,
				noticeSum: 0,
				spaceList: [],
				spaceshowList: [],
				submitStatus9: false,
				token: "",
				isGetChat: null,
				userInfo: null,
				sy_gpt: false,
				noLogin: false,

				// 应用相关
				appList: [], // 应用列表
				limit: 15,
				loading: false,
				finished: false,
				tagMap: {
					1: {
						text: $t('global.transport'),
						color: '#7c72ff'
					},
					2: {
						text: $t('global.original'),
						color: '#19be6b'
					},
					3: {
						text: $t('global.goldlabel'),
						color: '#ff6600'
					},
					4: {
						text: $t('global.official'),
						color: '#2979ff'
					}
				},

				// 筛选相关
				showOrder: false,
				orderOptions: [{
						text: $t('global.latestpost'),
						value: 'created'
					},
					{
						text: $t('global.ravereview'),
						value: 'score'
					},
					{
						text: $t('global.discusshot'),
						value: 'commentsNum'
					},
					{
						text: $t('global.lookaround'),
						value: 'random'
					}
				],
				selectedOrder: 'created',
				orderText: $t('global.latestpost'),

				// 系统筛选
				showSystem: false,
				systemOptions: [{
						label: $t('global.all'),
						value: ''
					},
					{
						label: 'Android',
						value: 'android'
					},
					{
						label: 'iOS',
						value: 'ios'
					}
				],
				selectedSystem: '',
				systemText: $t('global.system'),

				// 类型筛选
				showType: false,
				typeOptions: [{
						label: $t('global.all'),
						value: ''
					},
					{
						label: $t('global.transport'),
						value: '1'
					},
					{
						label: $t('global.original'),
						value: '2'
					},
					{
						label: $t('global.goldlabel'),
						value: '3'
					},
					{
						label: $t('global.official'),
						value: '4'
					}
				],
				selectedType: '',
				typeText: $t('global.type'),
				sy_appbox:false,

				// 修改加载状态的处理
				loadStatus: 'loadmore', // loadmore, loading, nomore
				loadMoreText: {
					loadmore: $t('tabpage.find.uploadmore'),
					loading: $t('global.loading'),
					nomore: $t('global.nomore')
				},
				shopPage: 1,
				shopMoreText: $t('common.loadmoretxt'),
				shopIsLoading: 0,
				shopSearchText: "",
				shopTypelist: [],
				shopSort: 0,
				shopSortText: "",
				shopSortList: [],
				shopSubtype: 0,
				shopSubtypeText: "",
				shopSubtypeList: [],
				isLoad: 0,
				// 新的筛选相关变量
				shopFilterShow: false,
				tempShopSort: 0,
				tempShopSortText: "",
				tempShopSubtype: 0,
				tempShopSubtypeText: "",
				tempShopSubtypeList: [],
				showSpaceTypePicker: false,
				spaceTypeOptions: [
					{ label: $t('tabpage.find.myfollow'), value: 0 },
					{ label: $t('tabpage.find.mostlike'), value: 1 },
					{ label: $t('tabpage.find.newupdate'), value: 2 }
				],
				spaceTypeText: $t('tabpage.find.newupdate'),
				
				// 配置化功能相关
				availableFeatures: [], // 当前可用的功能列表
				currentFeatureKey: '', // 当前显示的功能key
			}
		},
		computed: {
			topicRows() {
				const rows = [];
				for (let i = 0; i < this.tagList.length; i += 2) {
					rows.push(this.tagList.slice(i, i + 2));
				}
				return rows;
			}
		},
		mounted() {
			var that = this;
			uni.$on('onShow', function(data) {

				if (Number(data) != Number(that.curPage)) {
					return false;
				}
				
				if (that.homeStyle == 1) {
					that.swiperBgcolor = "#ffffff"
				} else {
					that.swiperBgcolor = "#ffffff"
				}
				if (localStorage.getItem('userinfo')) {
				
					that.userInfo = JSON.parse(localStorage.getItem('userinfo'));
					that.userInfo.style = "background-image:url(" + that.userInfo.avatar + ");"
					that.avatarurl = that.userInfo.avatar
					that.uid = that.userInfo.uid
					that.isvip = that.userInfo.isvip;
				} else {
					that.userInfo = null;
				}
				if (localStorage.getItem('token')) {
				
					that.token = localStorage.getItem('token');
				} else {
					that.token = "";
				}
				uni.$emit('tOnLazyLoadReachBottom');
				that.allCache();
				
				if (localStorage.getItem('getPlugins')) {
					var cachedPlugins = localStorage.getItem('getPlugins');
					if (cachedPlugins) {
						const pluginList = JSON.parse(cachedPlugins);
						that.sy_gpt = pluginList.includes('sy_gpt');
						// #ifdef APP-PLUS || H5
						that.sy_appbox = pluginList.includes('sy_appbox');
						// #endif
						// 在获取插件信息后重新初始化配置化功能，保持当前状态
						that.initConfigurableFeatures(true);
					}
				}
				if (localStorage.getItem('token')) {
				
					that.token = localStorage.getItem('token');
				}
				if (localStorage.getItem('identifyCompany')) {
					that.identifyCompany = localStorage.getItem('identifyCompany');
				}
				that.userStatus();
				that.unreadNum();
				if (that.noticeSum > 0 && that.noticeSum <= 99) {
					that.noticeSumof = true;
				} else if (that.noticeSum > 99) {
					that.noticeSumof = true;
					noticeSum = "99+"
				}
				if (localStorage.getItem('isinfoback')) {
					localStorage.removeItem('isinfoback');
					// 从详情页返回，恢复缓存数据但不重新请求
					that.allCache();
					// 从详情页返回时，恢复之前的功能状态
					that.initConfigurableFeatures(true);
				}else{
					// 只有在非详情页返回的情况下才重新加载数据
					that.allCache();
					that.loadingFun();
				}
				// 检查是否需要刷新数据
				that.checkAndRefreshData();
			});

			uni.$on('onReachBottom', function(data) {
				if (Number(data) != Number(that.curPage)) {
					return false;
				}
				that.loadMore();
			});

			uni.$on('onPullDownRefresh', function(data) {
				if (Number(data) != Number(that.curPage)) {
					return false;
				}
				that.getSet();
				that.loadingFun();
				that.userStatus();
				that.unreadNum();
			});
			
			// 监听刷新find页面事件
			uni.$on('refreshFindPage', function() {
				if (that.squareid == 1) {
					that.getSpaceList(false);
				}
				if (that.squareid == 5) {
					that.getSpaceshowList();
				}
			});
			// #ifdef APP-PLUS || MP
			that.NavBar = that.CustomBar;
			// #endif
		},
		beforeDestroy() {
			var that = this;
			uni.$off('onReachBottom')
			uni.$off('onShow')
			uni.$off('onPullDownRefresh')
			uni.$off('refreshFindPage')

			clearInterval(that.isGetChat);
			that.isGetChat = null
		},
		created() {
			var that = this;
			if (that.homeStyle == 1) {
				that.swiperBgcolor = "#ffffff"
			} else {
				that.swiperBgcolor = "#ffffff"
			}
			that.getSet();
			that.getGonggao();
			that.getIconimg();
			that.getadimg();
			that.getSwiperList();
			if (that.isvip == 0) {
				that.getAdsCache();
			}
			// 初始化广场数据
			that.getSpaceshowList();
			that.getUserList();
			that.getShopList();
			that.getRecommend();
			that.getTagList();

		},
		methods: {
			// 初始化配置化功能
			initConfigurableFeatures(preserveCurrentState = false) {
				try {
					const context = {
						shopof: this.shopof,
						tzof: this.tzof,
						wzof: this.wzof,
						sy_appbox: this.sy_appbox
					};
					// 获取可用功能列表
					this.availableFeatures = getFindPageFeatures(context);
					
					// 尝试恢复之前的状态
					let targetFeature = null;
					if (preserveCurrentState) {
						// 从缓存中恢复当前功能状态
						const savedFeatureKey = localStorage.getItem('find_currentFeatureKey');
						const savedSquareId = localStorage.getItem('find_squareId');
						
						if (savedFeatureKey && savedSquareId) {
							// 检查保存的功能是否在当前可用功能列表中
							targetFeature = this.availableFeatures.find(f => f.key === savedFeatureKey);
							if (targetFeature) {
								this.currentFeatureKey = savedFeatureKey;
								this.squareid = parseInt(savedSquareId);
							}
						}
					}
					// 如果没有找到保存的状态或保存的功能不可用，则使用默认功能
					if (!targetFeature) {
						const defaultFeature = getDefaultFindFeature(context);
						if (defaultFeature) {
							this.currentFeatureKey = defaultFeature.key;
							this.squareid = defaultFeature.id;
							// 保存默认状态
							this.saveFindPageState();
						}
					}
				} catch (error) {
					// 降级到默认行为
					this.availableFeatures = [];
					this.currentFeatureKey = 'square';
					this.squareid = 5;
					this.saveFindPageState();
				}
			},
			
			// 保存find页面状态
			saveFindPageState() {
				localStorage.setItem('find_currentFeatureKey', this.currentFeatureKey);
				localStorage.setItem('find_squareId', this.squareid.toString());
			},
			
			// 切换功能（替换原来的setSquare逻辑）
			switchToFeature(featureKey) {
				const feature = this.availableFeatures.find(f => f.key === featureKey);
				if (feature) {
					this.currentFeatureKey = featureKey;
					this.squareid = feature.id;
					// 保存当前状态
					this.saveFindPageState();
					// 切换功能
					this.setSquare(feature.id);
				}
			},
			swiperclick(index) {
				const data = this.swiperList2[index];
				this.goAds2(data.zt)
			},

			goAppInfo(item) {
				uni.navigateTo({
					url: '/pages/plugins/sy_appbox/info'
				});
			},
			toLink(text, lgof) {
				var that = this;
				if (lgof == "true") {
					if (!localStorage.getItem('token') || localStorage.getItem('token') == "") {
						uni.showToast({
							title: that.$t('common.plslogin'),
							icon: 'none'
						})
						return false;
					}
				}
				uni.navigateTo({
					url: text
				});
			},
			getSet() {
				var that = this;
				uni.request({
					url: that.$API.SPset(),
					method: 'GET',
					dataType: "json",
					success(res) {
						that.kuaijie = res.data.kuaijie;
						that.radiusBoxStyle = res.data.radiusBoxStyle;
						that.radiusStyle = res.data.radiusStyle;
						that.fatherTitle = res.data.fatherTitle;
						that.swiperStyle = res.data.swiperStyle2;
						that.tabCurTab = res.data.swiperinfo;
						that.swiperType = res.data.swiperType;
						that.recommendOf = res.data.recommendOf;
						that.actStyle = res.data.topStyle;
						that.wzof = res.data.wzof;
						that.tzof = res.data.tzof;
						that.shopof = res.data.shopof;
						localStorage.setItem('tabCurTab', that.tabCurTab);
					// 在获取设置后初始化配置化功能
					// 检查是否是首次加载（没有保存的状态）
						const hasExistingState = localStorage.getItem('find_currentFeatureKey');
						that.initConfigurableFeatures(!!hasExistingState);
					},
				})

			},
			getGonggao() {
				var that = this;
				uni.request({
					url: that.$API.SPgonggao(),
					method: 'GET',
					dataType: "json",
					success(res) {
						that.Hyperlinks = res.data.Hyperlinks;
						that.Gallery = res.data.Gallery;
						that.curIMG = res.data.videoimg;
						that.Findtop = res.data.Findtop;
						that.Bannerswitch = res.data.Bannerswitch;
						that.Code = res.data.Code;
					},
				})
			},
			toUserList(){
				uni.navigateTo({
					url: '/pages/contents/search?type=2'
				});
			},
			chatFormatDate(datetime) {
				var datetime = new Date(parseInt(datetime * 1000));
				// 获取年月日时分秒值  slice(-2)过滤掉大于10日期前面的0
				var year = datetime.getFullYear();
				var month = ("0" + (datetime.getMonth() + 1)).slice(-2);
				var date = ("0" + datetime.getDate()).slice(-2);
				var hour = ("0" + datetime.getHours()).slice(-2);
				var minute = ("0" + datetime.getMinutes()).slice(-2);
				var time = year + "" + month + "" + date;

				var result = hour + ":" + minute;
				var curDate = new Date();
				var curYear = curDate.getFullYear(); //获取完整的年份(4位)
				var curMonth = ("0" + (curDate.getMonth() + 1)).slice(-2);
				var curDay = ("0" + curDate.getDate()).slice(-2); //获取当前日(1-31)
				var curTime = curYear + "" + curMonth + "" + curDay;
				if (year == curYear) {
					if (year == curYear) {
						if (date == curDay) {
							result = hour + ":" + minute;
						} else {
							result = month + "-" + date;
						}
					} else {
						result = month + "-" + date;
					}
				} else {
					result = month + "-" + date;
				}
				return result;
			},
			goMsg() {
				var that = this;

				if (!localStorage.getItem('token') || localStorage.getItem('token') == "") {
					uni.showToast({
						title: that.$t('common.plslogin'),
						icon: 'none'
					})
					return false;
				}
				uni.$emit('goMsg', 2);
			},
			goUserInfo() {
				if (!localStorage.getItem('token') || localStorage.getItem('token') == "") {
					uni.navigateTo({
						url: '/pages/user/login'
					});
					return false;
				}
				uni.$emit('goUser', 0);
			},
			searchClose() {
				var that = this;
				that.searchText = "";
				that.page = 1;
				that.getUserList(false);
			},
			loadMore() {
				var that = this;
				that.moreText = that.$t('global.loading');
				that.isLoad = 1;
				if (that.squareid == 1) {
					that.getSpaceList(true);
				}
				if (that.squareid == 4) {
					that.shopLoadMore();
				}
				if (that.squareid == 5) {
					that.getSpaceshowList();
				}
			},

			getImg() {
				return Math.floor(Math.random() * 35);
			},
			// 点击左边的栏目切换
			async swichMenu(index) {
				if (index == this.current) return; // 如果点击当前项则不处理

				this.current = index;
				this.page = 1;
				this.finished = false;
				this.loading = false;
				this.getAppList();
				if (this.menuHeight == 0 || this.menuItemHeight == 0) {
					await this.getElRect('menu-scroll-view', 'menuHeight');
					await this.getElRect('u-tab-item', 'menuItemHeight');
				}
				// 将菜单菜单活动item垂直居中
				this.scrollTop = index * this.menuItemHeight + this.menuItemHeight / 2 - this.menuHeight / 2;

			},
			// 获取一个目标元素的高度
			getElRect(elClass, dataVal) {
				new Promise((resolve, reject) => {
					const query = uni.createSelectorQuery().in(this);
					query.select('.' + elClass).fields({
						size: true
					}, res => {
						// 如果节点尚未生成，res值为null，循环调用执行
						if (!res) {
							setTimeout(() => {
								this.getElRect(elClass);
							}, 10);
							return;
						}
						this[dataVal] = res.height;
					}).exec();
				})
			},
			toSet() {
				uni.navigateTo({
					url: '/pages/user/setup'
				});
			},

			getIconimg() {
				var that = this;
				uni.request({
					url: that.$API.SPiconimg(),
					method: 'GET',
					dataType: "json",
					success(res) {
						if (res.data instanceof Array) {
							that.iconimg = res.data;
						} else {
							that.iconimg = Object.values(res.data);
						}
						localStorage.setItem('iconimg', JSON.stringify(that.iconimg));
					},
				});
			},
			arraysEqual(a, b) {
				if (a === b) return true;
				if (a == null || b == null) return false;
				if (a.length != b.length) return false;
				for (var c in a) {
					for (var d in b) {
						if (b[d].id == a[c].id) {
							if (b[d].lastTime != a[c].lastTime) {
								return false;
							}
						}

					}
				}
			},
			formatDate(datetime) {
				var now = new Date();
				var diff = now - new Date(datetime * 1000);
				var minuteDiff = Math.floor(diff / 60000);
				var hourDiff = Math.floor(diff / 3600000);
				var dayDiff = Math.floor(diff / 86400000);
				var weekDiff = Math.floor(dayDiff / 7);
				var monthDiff = Math.floor(diff / 2592000000);
				var yearDiff = Math.floor(diff / 31536000000);

				if (diff < 60000) {
					return Math.floor(diff / 1000) + this.$t('global.secondago');
				} else if (diff < 3600000) {
					return minuteDiff + this.$t('global.minutesago');
				} else if (hourDiff < 24) {
					return hourDiff + this.$t('global.hourago');
				} else if (dayDiff < 7 && dayDiff > 0) {
					return dayDiff + this.$t('global.dayago');
				} else if (weekDiff > 0 && monthDiff <= 1) {
					return weekDiff + this.$t('global.weekago');
				} else if (monthDiff > 1 && monthDiff < 12) {
					return monthDiff + this.$t('global.monthago');
				} else if (yearDiff >= 1) {
					return yearDiff + this.$t('global.yearago');
				} else {
					return this.$t('global.justago');
				}
			},

			setSquare(type) {
				var that = this;
				// if(reset){
				// 	that.page = 1;
				// }
				that.squareid = type;
				
				// 同步更新currentFeatureKey
				const feature = that.availableFeatures.find(f => f.id === type);
				if (feature) {
					that.currentFeatureKey = feature.key;
					// 保存状态
					that.saveFindPageState();
				}
				
				clearInterval(that.isGetChat);
				that.isGetChat = null
				if (type == 0) {
					that.getadimg();
					that.getSectionList(false);
					that.getSwiperList();
				}
				if (type == 3) {
					that.getMetaList();
				}
				if (type == 2) {
					if(that.sy_appbox){
						that.getSortList();
					}
					
				}
				if (type == 1) {
					// 只有在动态列表为空时才重新加载，避免覆盖已加载的分页数据
					if (that.spaceList.length === 0) {
						that.getSpaceList(false);
					}
				}
				if(type == 5){
					that.getadimg();
					that.getSpaceshowList();
					that.getUserList();
					that.getShopList();
					that.getRecommend();
					that.getTagList();
				}
				if(type == 4){
					that.shopGetShopTypeList();
					that.shopGetShopList();
				}
			},
			getAdsCache() {
				var that = this;
				if (localStorage.getItem('bannerAds')) {
					that.bannerAds = JSON.parse(localStorage.getItem('bannerAds'));
					var num = that.bannerAds.length;
					if (num > 0) {
						var rand = Math.floor(Math.random() * num);
						that.bannerAdsInfo = that.bannerAds[rand];
					}
				}
			},

			getSpaceshowList() {
				var that = this;
				if (that.submitStatus9) {
					return false;
				}
				
				that.submitStatus9 = true;
				var data = {
					"status": 1
				}
				var token = "";
				if (localStorage.getItem('userinfo')) {
					var userInfo = JSON.parse(localStorage.getItem('userinfo'));
					token = userInfo.token;
				
				}
				that.$Net.request({
					url: that.$API.spaceList(),
					data: {
						"searchParams": JSON.stringify(that.$API.removeObjectEmptyKey(data)),
						"limit": 10,
						"page": 1,
						"order": "likes",
						"token": token
					},
					method: "get",
					dataType: 'json',
					success: function(res) {
						that.spaceshowLoad= true;
						that.submitStatus9 = false;
						if (res.data.code == 1) {
							that.noLogin = false;
							var list = res.data.data;
							
							var spaceshowList = [];
							for (var i in list) {
								if (list[i].type == 0) {
									if (list[i].pic) {
										var pic = list[i].pic;
										list[i].picList = pic.split("||");
									} else {
										list[i].picList = [];
									}
								}
								if (list[i].type == 2) {
									if (list[i].forwardJson.pic) {
										var pic = list[i].forwardJson.pic;
										list[i].forwardJson.picList = pic.split("||");
									} else {
										list[i].forwardJson.picList = [];
									}
								}
							}
							spaceshowList = list;
							that.spaceshowList = spaceshowList;
							if (list.length > 0) {
								localStorage.setItem('spaceshowList', JSON.stringify(spaceshowList));
							}
						} else {
							
						}
					},
					fail: function(res) {
						that.submitStatus9 = false;
						that.spaceshowLoad = true;
					}
				})
			},
			getSpaceList(isPage, isLogin) {
				var that = this;
				if (that.submitStatus1) {
					return false;
				}
				that.submitStatus1 = true;
				var token = "";
				if (!isLogin) {
					localStorage.setItem('isbug', '1');
				}

				var page = that.page;
				if (isPage) {
					page++;
				}
				var data = {
					"status": 1
				}
				var spaceDataType = that.spaceDataType;
				var url = that.$API.followSpace();
				var order = "created";
				if (spaceDataType > 0) {
					url = that.$API.spaceList();
				}
				if (spaceDataType == 1) {
					order = "likes";
				}
				that.$Net.request({
					url: url,
					data: {
						"searchParams": JSON.stringify(that.$API.removeObjectEmptyKey(data)),
						"limit": 10,
						"page": page,
						"order": order,
						"token": token
					},
					method: "get",
					dataType: 'json',
					success: function(res) {
						if (!isLogin) {
							localStorage.removeItem('isbug');
						}
						that.submitStatus1 = false;
						that.spaceLoad = true;
						that.isLoad = 0;
						that.moreText = that.$t('common.loadmoretxt');
						if (!isPage) {
							that.dataLoad = true;
						}
						if (res.data.code == 1) {
							that.noLogin = false;
							var list = res.data.data;
							var spaceList = [];
							for (var i in list) {
								if (list[i].type == 0) {
									if (list[i].pic) {
										var pic = list[i].pic;
										list[i].picList = pic.split("||");
									} else {
										list[i].picList = [];
									}
								}
								if (list[i].type == 2) {
									if (list[i].forwardJson.pic) {
										var pic = list[i].forwardJson.pic;
										list[i].forwardJson.picList = pic.split("||");
									} else {
										list[i].forwardJson.picList = [];
									}
								}
							}
							spaceList = list;
							if (list.length > 0) {
								if (isPage) {
									that.page++;
									that.spaceList = that.spaceList.concat(spaceList);
								} else {
									that.spaceList = spaceList;
								}
								// 存储完整的累积数据，而不是只存储当前页
								localStorage.setItem('spaceList', JSON.stringify(that.spaceList));
							} else {
								that.moreText = that.$t('global.nomoredynamic');
							}
						} else {
							if (res.data.msg == "用户未登录或Token验证失败") {
								if (isLogin) {
									that.noLogin = true
								} else {
									that.getSpaceList(isPage, true);
								}
							}
						}
					},
					fail: function(res) {
						if (!isLogin) {
							localStorage.removeItem('isbug');
						}
						that.submitStatus1 = false;
						that.spaceLoad = true;
						that.moreText = that.$t('common.loadmoretxt');
						that.isLoad = 0;
					}
				})
			},
			setSpaceDataType(type) {
				var that = this;
				that.spaceDataType = type;
				that.spaceLoad = false;
				that.page = 1;
				that.spaceList = [];
				that.getSpaceList(false);
			},
			userStatus() {
				var that = this;
				that.$Net.request({
					url: that.$API.userStatus(),
					data: {
						"token": that.token
					},
					header: {
						'Content-Type': 'application/x-www-form-urlencoded'
					},
					method: "get",
					dataType: 'json',
					success: function(res) {
						if (res.data.code == 0) {
							localStorage.removeItem('userinfo');
							localStorage.removeItem('token');
							that.token = "";
							that.userinfo = null;
						} else if (res.data.code == 1) {
							that.avatarurl = res.data.data.avatar;
							if (localStorage.getItem('identifyCompany')) {
								that.identifyCompany = localStorage.getItem('identifyCompany');
							} else {
								var myuid = res.data.data.uid
								that.getRz(myuid)
							}
							var userInfo = JSON.parse(localStorage.getItem('userinfo'));
							if (res.data.data.isvip) {
								userInfo.isvip = res.data.data.isvip;
							}
							if (res.data.data.vip) {
								userInfo.vip = res.data.data.vip;
							}
							if (res.data.data.avatar) {
								userInfo.avatar = res.data.data.avatar;
							}
							localStorage.setItem('userinfo', JSON.stringify(userInfo));
						}
					},
					fail: function(res) {
						uni.showToast({
							title: that.$t('common.networkfail'),
							icon: 'none'
						})
					}
				})
			},
			getRz(uid) {
				var that = this;
				that.$Net.request({
					url: that.$API.identifyStatus(),
					data: {
						"uid": uid
					},
					header: {
						'Content-Type': 'application/x-www-form-urlencoded'
					},
					method: "get",
					dataType: 'json',
					success: function(res) {
						if (res.data.code == 1) {
							that.identifyCompany = res.data.data.identifyCompany;
							localStorage.setItem('identifyCompany', that.identifyCompany);
						}
						var timer = setTimeout(function() {
							clearTimeout('timer')
						}, 300)
					},
					fail: function(res) {
						var timer = setTimeout(function() {
							clearTimeout('timer')
						}, 300)
					}
				})
			},
			loadingFun() {
				var that = this;
				// 刷新时重新初始化配置化功能，保持当前状态
				that.initConfigurableFeatures(true);
				
				if (that.squareid == 0) {
					that.getSectionList(false);
					that.getSwiperList();
					that.getRecommend();
					that.getRecommendSectionList();
				}
				if (that.squareid == 1) {
					that.getSpaceList(false);
				}
				if (that.squareid == 2) {
					if(that.sy_appbox)
					{
						that.getSortList();
					}
				}
				if (that.squareid == 3) {
					that.getMetaList();
				}
				if(that.squareid == 4){
					that.shopGetShopTypeList();
					that.shopGetShopList();
				}
				if(that.squareid == 5){
					that.getSpaceshowList();
				}
			},
			getadimg() {
				var that = this;
				uni.request({
					url: that.$API.SPadimg(),
					method: 'GET',
					dataType: "json",
					success(res) {
						that.adimage_sl = res.data.adimage_sl;
						// 清空之前的数据
						that.swiperList2 = [];
						// 动态设置swiperList2内容
						for (let i = 1; i <= that.adimage_sl; i++) {
							that.swiperList2.push({
								url: res.data['adimage' + i],
								zt: res.data['link_url' + i]
							});
						}
						localStorage.setItem('swiperList2', JSON.stringify(that.swiperList2));
					},
					fail: function(error) {
						
					}
				});
			},
			replaceSpecialChar(text) {
				text = text.replace(/&quot;/g, '"');
				text = text.replace(/&amp;/g, '&');
				text = text.replace(/&lt;/g, '<');
				text = text.replace(/&gt;/g, '>');
				text = text.replace(/&nbsp;/g, ' ');
				return text;
			},
			allCache() {
				var that = this;
				var timer = setTimeout(function() {
					that.isLoading = 1;
					clearTimeout('timer')
				}, 300)
				if (localStorage.getItem('tabCurTab')) {
					that.tabCurTab = localStorage.getItem('tabCurTab');
				}
				if (localStorage.getItem('identifyCompany')) {
					that.identifyCompany = localStorage.getItem('identifyCompany');
				} else {
					that.getRz()
				}
				if (localStorage.getItem('swiperList2')) {
					that.swiperList2 = JSON.parse(localStorage.getItem('swiperList2'));
				}
				if (localStorage.getItem('swiperList')) {
					that.swiperList = JSON.parse(localStorage.getItem('swiperList'));
				}
				if (localStorage.getItem('recommendSectionList')) {
					that.recommendSectionList = JSON.parse(localStorage.getItem('recommendSectionList'));
				}
				if (localStorage.getItem('sectionList')) {
					that.sectionList = JSON.parse(localStorage.getItem('sectionList'));
				}
				if (localStorage.getItem('iconimg')) {
					that.iconimg = JSON.parse(localStorage.getItem('iconimg'));
				}
				if (localStorage.getItem('userList')) {
					that.userList = JSON.parse(localStorage.getItem('userList'));
				}
				if (localStorage.getItem('find_shopList')) {
					that.shopList = JSON.parse(localStorage.getItem('find_shopList'));
				}
				if (localStorage.getItem('recommendList')) {
					that.recommendList = JSON.parse(localStorage.getItem('recommendList'));
				}
				if (localStorage.getItem('find_metaList')) {
					that.metaList = JSON.parse(localStorage.getItem('find_metaList'));
				}
				if (localStorage.getItem('find_tagList')) {
					that.tagList = JSON.parse(localStorage.getItem('find_tagList'));
				}
				if (localStorage.getItem('spaceList')) {
					that.spaceList = JSON.parse(localStorage.getItem('spaceList'));
				}
				if (localStorage.getItem('spaceshowList')) {
					that.spaceshowList = JSON.parse(localStorage.getItem('spaceshowList'));
				}
				// 恢复find页面状态
				if (localStorage.getItem('find_currentFeatureKey')) {
					that.currentFeatureKey = localStorage.getItem('find_currentFeatureKey');
				}
				if (localStorage.getItem('find_squareId')) {
					that.squareid = parseInt(localStorage.getItem('find_squareId'));
				}
				
			},

			getDowns(downs) {
				var that = this;
				if (downs <= 999) {
					return downs;
				} else if (downs > 999 && downs <= 9999) {
					return (downs / 1000).toFixed(1) + that.$t('global.thousand');
				} else if (downs > 9999) {
					return (downs / 10000).toFixed(1) + that.$t('global.many');
				}
			},
			getRecommendSectionList(isLogin) {
				var that = this;
				if (that.submitStatus2) {
					return false;
				}
				that.submitStatus2 = true;
				var token = "";
				if (!isLogin) {
					localStorage.setItem('isbug', '1');
				}

				var data = {
					"isrecommend": 1,
				}
				that.$Net.request({
					url: that.$API.sectionList(),
					data: {
						"searchParams": JSON.stringify(that.$API.removeObjectEmptyKey(data)),
						"limit": 8,
						"page": 1,
						"token": token
					},
					header: {
						'Content-Type': 'application/x-www-form-urlencoded'
					},
					method: "get",
					dataType: 'json',
					success: function(res) {
						if (!isLogin) {
							localStorage.removeItem('isbug');
						}
						that.submitStatus2 = false;
						uni.stopPullDownRefresh()
						that.isLoad = 0;
						if (res.data.code == 1) {
							var list = res.data.data;
							that.recommendSectionList = res.data.data;
							localStorage.setItem('recommendSectionList', JSON.stringify(that
								.recommendSectionList));
						} else {
							if (res.data.msg == "用户未登录或Token验证失败") {
								if (isLogin) {
									that.noLogin = true
								} else {
									that.getRecommendSectionList(true);
								}
							}
						}
						var timer = setTimeout(function() {
							clearTimeout('timer')
						}, 300)
					},
					fail: function(res) {
						if (!isLogin) {
							localStorage.removeItem('isbug');
						}
						that.submitStatus2 = false;
						uni.stopPullDownRefresh()

					}
				})
			},
			getSectionList(isLogin) {
				var that = this;
				if (that.submitStatus3) {
					return false;
				}
				that.submitStatus3 = true;
				var token = "";
				if (!isLogin) {
					localStorage.setItem('isbug', '1');
				}

				that.$Net.request({
					url: that.$API.sectionList(),
					data: {
						"limit": 50,
						"page": 1,
						"searchKey": that.searchText,
						"token": token
					},
					header: {
						'Content-Type': 'application/x-www-form-urlencoded'
					},
					method: "get",
					dataType: 'json',
					success: function(res) {
						if (!isLogin) {
							localStorage.removeItem('isbug');
						}
						that.submitStatus3 = false;
						uni.stopPullDownRefresh()
						that.isLoad = 0;
						if (res.data.code == 1) {
							var list = res.data.data;
							var parentList = [];
							for (var i in list) {
								if (list[i].parent == 0) {
									list[i].subList = [];
									parentList.push(list[i]);
								}
							}
							for (var j in list) {
								if (list[j].parent != 0) {
									for (var p in parentList) {
										if (list[j].parent == parentList[p].id) {
											parentList[p].subList.push(list[j]);
										}
									}
								}
							}
							that.sectionList = parentList;
							localStorage.setItem('sectionList', JSON.stringify(that.sectionList));
						} else {
							if (res.data.msg == "用户未登录或Token验证失败") {
								if (isLogin) {
									that.noLogin = true
								} else {
									that.getSectionList(true);
								}
							}
						}
					},
					fail: function(res) {
						if (!isLogin) {
							localStorage.removeItem('isbug');
						}
						that.submitStatus3 = false;
						uni.stopPullDownRefresh()
						that.moreText = that.$t('common.loadmoretxt');
						that.isLoad = 0;
					}
				})
			},
			postSpace(type) {
				if (type == 1) {
					uni.navigateTo({
						url: '/pages/edit/articlePost'
					});
				} else if (type == 5) {
					uni.navigateTo({
						url: '/pages/edit/addshop'
					});
				} else {
					uni.navigateTo({
						url: '/pages/space/post?type=' + type
					});
				}
			},
			getSwiperList() {
				var that = this;
				var token = "";
				if (localStorage.getItem('userinfo')) {
					var userInfo = JSON.parse(localStorage.getItem('userinfo'));
					token = userInfo.token;
				}
				var data = {
					"isswiper": '1'
				}
				that.$Net.request({
					url: that.$API.postList(),
					data: {
						"searchParams": JSON.stringify(that.$API.removeObjectEmptyKey(data)),
						"limit": 5,
						"page": 1,
						"token": token
					},
					header: {
						'Content-Type': 'application/x-www-form-urlencoded'
					},
					method: "get",
					dataType: 'json',
					success: function(res) {
						if (res.data.code == 1) {
							var list = res.data.data;
							var list = res.data.data;
							var swiper = [];
							if (list.length > 0) {
								for (var i in list) {
									if (list[i].images.length > 0) {
										var arr = {
											id: list[i].id,
											type: 'image',
											url: list[i].images[0],
											title: list[i].title,
											intro: that.subText(list[i].text, 20),
										}
										swiper.push(arr);
									}

								}
								that.swiperList = swiper.concat(that.swiperList2);
							} else {
								that.swiperList = that.swiperList2;
							}
							localStorage.setItem('swiperList', JSON.stringify(that.swiperList));
						}

					},
					fail: function(res) {

					}
				})
			},
			getRecommend(isLogin) {
				var that = this;
				if (that.submitStatus5) {
					return false;
				}
				that.submitStatus5 = true;
				var token = "";
				if (!isLogin) {
					localStorage.setItem('isbug', '1');
				}

				var data = {
					"type": "post",
					"isrecommend": 1
				}
				that.$Net.request({
					url: that.$API.getContentsList(),
					data: {
						"searchParams": JSON.stringify(that.$API.removeObjectEmptyKey(data)),
						"limit": 5,
						"page": 1,
						"order": "modified",
						"token": token
					},
					header: {
						'Content-Type': 'application/x-www-form-urlencoded'
					},
					method: "get",
					dataType: 'json',
					success: function(res) {
						if (!isLogin) {
							localStorage.removeItem('isbug');
						}
						that.submitStatus5 = false;
						if (res.data.code == 1) {
							that.noLogin = false;
							var list = res.data.data;
							if (list.length > 0) {

								that.recommendList = list;

							} else {
								that.recommendList = [];
							}
							localStorage.setItem('recommendList', JSON.stringify(that.recommendList));
						} else {
							if (res.data.msg == "用户未登录或Token验证失败") {
								if (isLogin) {
									that.noLogin = true
								} else {
									that.getRecommend(true);
								}
							}
						}
					},
					fail: function(res) {
						if (!isLogin) {
							localStorage.removeItem('isbug');
						}
						that.submitStatus5 = false;
					}
				})
			},
			getMetaList() {
				var that = this;
				var data = {
					"type": "category",
					"parent": 0
				}
				that.$Net.request({
					url: that.$API.getMetasList(),
					data: {
						"searchParams": JSON.stringify(that.$API.removeObjectEmptyKey(data)),
						"limit": 40,
						"page": 1,
						"order": "order"
					},
					header: {
						'Content-Type': 'application/x-www-form-urlencoded'
					},
					method: "get",
					dataType: 'json',
					success: function(res) {
						if (res.data.code == 1) {
							var list = res.data.data;
							if (list.length > 0) {
								that.metaList = list;
								localStorage.setItem('find_metaList', JSON.stringify(that.metaList));
							}
						}
					},
					fail: function(res) {
						
					}
				})
			},
			goAds2(url) {
				// #ifdef APP-PLUS
				plus.runtime.openWeb(url);
				// #endif
				// #ifdef H5
				window.open(url)
				// #endif
			},
			goAds(data) {
				var url = data.url;
				var type = data.urltype;
				// #ifdef APP-PLUS
				if (type == 1) {
					plus.runtime.openURL(url);
				}
				if (type == 0) {
					plus.runtime.openWeb(url);
				}
				// #endif
				// #ifdef H5
				window.open(url)
				// #endif
			},
			getTagList() {
				var that = this;
				var data = {
					"type": "tag",
					"isrecommend": "1"
				}
				that.$Net.request({
					url: that.$API.getMetasList(),
					data: {
						"searchParams": JSON.stringify(that.$API.removeObjectEmptyKey(data)),
						"limit": 50,
						"page": 1,
						"order": "count"
					},
					header: {
						'Content-Type': 'application/x-www-form-urlencoded'
					},
					method: "get",
					dataType: 'json',
					success: function(res) {
						if (res.data.code == 1) {
							var list = res.data.data;
							if (list.length > 0) {
								that.tagList = list;
								localStorage.setItem('find_tagList', JSON.stringify(that.tagList));
							}
						}
					},
					fail: function(res) {
						
					}
				})
			},
			toSearch() {
				var that = this;
				if (that.noLogin) {
					uni.navigateTo({
						url: '/pages/user/login'
					});
					return false;
				}
				uni.navigateTo({
					url: '/pages/contents/search'
				});
			},
			shopInfo(data) {
				var that = this;

				if (that.isAdmin) {
					return false
				} else {
					uni.navigateTo({
						url: '/pages/shop/shopinfo?sid=' + data.id
					});
				}
			},
			getShopList() {
				var that = this;
				var data = {
					"status": "1",
					"isView": "1"
				}
				that.$Net.request({
					url: that.$API.shopList(),
					data: {
						"searchParams": JSON.stringify(that.$API.removeObjectEmptyKey(data)),
						"limit": 6,
						"page": 1,
						"order": "sellNum"
					},
					header: {
						'Content-Type': 'application/x-www-form-urlencoded'
					},
					method: "get",
					dataType: 'json',
					success: function(res) {
						if (res.data.code == 1) {
							var list = res.data.data;
							that.shopList = list;
							localStorage.setItem('find_shopList', JSON.stringify(that.shopList));
						}
					},
					fail: function(res) {
						uni.showToast({
							title: that.$t('common.networkfail'),
							icon: 'none'
						})

					}
				})
			},
			getUserList() {
				var that = this;
				var token = ""
				if (localStorage.getItem('userinfo')) {
					var userInfo = JSON.parse(localStorage.getItem('userinfo'));
					token = userInfo.token;

				}
				that.$Net.request({
					url: that.$API.getUserList(),
					data: {
						"searchParams": "",
						"limit": 10,
						"page": 1,
						"order": "posttime",
						"token": token
					},
					header: {
						'Content-Type': 'application/x-www-form-urlencoded'
					},
					method: "get",
					dataType: 'json',
					success: function(res) {
						if (res.data.code == 1) {
							var list = res.data.data;
							if (list.length > 0) {

								var userList = [];
								for (var i in list) {
									var arr = list[i];
									arr.style = "background-image:url(" + list[i].avatar + ");"
									// 确保认证和VIP信息存在
									arr.lvrz = arr.lvrz || 0;
									arr.isvip = arr.isvip || 0;
									// 确保介绍信息存在
									if (!arr.introduce || arr.introduce === '') {
										arr.introduce = that.$t('global.nopersoninfo');
									}
									userList.push(arr);
								}
								that.userList = userList;
								localStorage.setItem('userList', JSON.stringify(that.userList));

							}
						}
					},
					fail: function(res) {}
				})
			},
			toCategoryContents(title, id, type) {
				if(type){
					type = "tag";
				}else{
					type = "meta";
				}
				uni.navigateTo({
					url: '/pages/contents/contentlist?title=' + title + "&type=" + type + "&id=" + id
				});
			},
			toTopContents(title, id) {
				var type = "meta";
				uni.navigateTo({
					url: '/pages/contents/contentlist?title=' + title + "&type=top&id=" + id
				});
			},
			toInfo(data) {
				uni.navigateTo({
					url: '/pages/contents/info?cid=' + data.cid + "&title=" + data.title
				});
			},
			toAlltag() {
				uni.navigateTo({
					url: '/pages/contents/alltag'
				});
			},
			toAllcategory() {
				uni.navigateTo({
					url: '/pages/contents/allcategory'
				});
			},
			goPage(url) {
				uni.navigateTo({
					url: url
				});
			},
			toRecommend() {
				uni.navigateTo({
					url: '/pages/contents/recommend'
				});
			},
			toGroup() {
				var url = that.$API.GetGroupUrl();
				// #ifdef APP-PLUS
				plus.runtime.openURL(url)
				// #endif
				// #ifdef H5
				window.open(url)
				// #endif
			},
			toAds(url) {
				// #ifdef APP-PLUS
				plus.runtime.openURL(url)
				// #endif
				// #ifdef H5
				window.open(url)
				// #endif
			},
			unreadNum() {
				var that = this;
				if (localStorage.getItem('noticeSum')) {
					that.noticeSum = Number(localStorage.getItem('noticeSum'));
				}
			},
			toLink(text) {
				var that = this;
				if (!localStorage.getItem('token') || localStorage.getItem('token') == "") {
					uni.showToast({
						title: that.$t('common.plslogin'),
						icon: 'none'
					})
					return false;
				}
				uni.navigateTo({
					url: text
				});
			},
			goRegister() {
				uni.navigateTo({
					url: '/pages/user/register'
				});
			},
			goLogin() {
				uni.navigateTo({
					url: '/pages/user/login'
				});
			},
			toUserContents(data) {
				var that = this;
				var name = data.name;
				var title = data.name + that.$t('common.nameinfo');
				if (data.screenName) {
					title = data.screenName + that.$t('common.nameinfo');
					name = data.screenName
				}
				var id = data.uid;
				var type = "user";
				uni.navigateTo({
					url: '/pages/contents/userinfo?title=' + title + "&name=" + name + "&uid=" + id + "&avatar=" +
						encodeURIComponent(data.avatar)
				});
			},
			subText(text, num) {
				if (text) {
					if (text.length > num) {
						text = text.substring(0, num);
						return text + "……";
					} else {
						return text;
					}
				} else {
					return this.$t('global.nopersoninfo')
				}
			},
			// 获取分区
			getSortList() {
				const that = this;
				that.$Net.request({
					url: that.$API.PluginLoad('sy_appbox'),
					data: {
						"action": "getSortList",
						"getsort_page": 1,
						"getsort_limit": 50,
						"getsort_order": "sort"
					},
					method: "GET",
					dataType: 'json',
					success: function(res) {
						if (res.data.code == 200) {
							// 添加"小编推荐"作为第一个分区
							that.tabbar = [{
								name: that.$t('tabpage.find.myrecommend'),
								slug: 'recommend',
								id: 0
							}, ...res.data.data];
						}
						that.getAppList();
					}
				});
			},
			// 获取应用列表
			getAppList(isPage = false) {
				const that = this;
				if (that.loading) return;

				if (!isPage) that.loading = true;
				that.loadStatus = 'loading';
				const page = isPage ? that.page + 1 : 1;

				// 构建筛选条件
				let conditions = {};
				if (that.selectedSystem != '') {
					conditions.system = that.selectedSystem
				}
				if (that.selectedType != '') {
					conditions.type = that.selectedType
				}
				if (that.current === 0) {
					conditions.istop = '1';
				} else if (that.tabbar[that.current]) {
					conditions.sort = String(that.tabbar[that.current].id);
				}

				that.$Net.request({
					url: that.$API.PluginLoad('sy_appbox'),
					data: {
						"action": "getAppList",
						"getapp_page": page,
						"getapp_limit": that.limit,
						"getapp_order": that.selectedOrder,
						"getapp_if": JSON.stringify(conditions)
					},
					method: "GET",
					dataType: 'json',
					success: function(res) {
						if (res.data.code == 200) {
							const data = res.data.data || [];
							const list = data.map(item => ({
								...item,
								tagInfo: that.tagMap[item.type] || {
									text: that.$t('global.unknown'),
									color: '#999'
								},
								size: that.formatSize(item.size)
							}));

							if (isPage) {
								// 加载更多时，使用数组拓展运算符合并数组
								that.appList = [...that.appList, ...list];
								that.page = page;
							} else {
								// 只有在初加载或刷新时才重置列表
								that.appList = list;
								that.page = 1;
							}

							that.finished = list.length < that.limit;
							that.loadStatus = that.finished ? 'nomore' : 'loadmore';
						}
						that.appLoad = true;
						that.loading = false;
					},
					fail: function() {
						that.appLoad = true;
						that.loading = false;
						that.loadStatus = 'loadmore';
					}
				});
			},

			// 触底加载
			handleScrollToLower() {
				if (this.loadStatus === 'loadmore' && !this.loading&&this.sy_appbox) {
					this.getAppList(true);
				}
			},

			// 筛选相关方法
			showOrderPicker() {
				this.showOrder = true;
			},

			confirmOrder(e) {
				const selectedOption = this.orderOptions[e[0]];
				if (selectedOption) {
					this.selectedOrder = selectedOption.value;
					this.orderText = selectedOption.text;
					this.showOrder = false;
					this.page = 1; // 重置页码
					if(this.sy_appbox){
						this.getAppList(false); // 使用false参数重新加载
					}
				}
			},

			showSystemFilter() {
				this.showSystem = true;
			},

			confirmSystem() {
				const option = this.systemOptions.find(item => item.value === this.selectedSystem);
				this.systemText = option ? option.label : this.$t('global.system');
				this.showSystem = false;
				this.page = 1; // 重置页码
				if(this.sy_appbox){
					this.getAppList(false); // 使用false参数重新加载
				}
			},

			showTypeFilter() {
				this.showType = true;
			},

			confirmType() {
				const option = this.typeOptions.find(item => item.value === this.selectedType);
				this.typeText = option ? option.label : this.$t('global.type');
				this.showType = false;
				this.page = 1; // 重置页码
				if(this.sy_appbox){
					this.getAppList(false); // 使用false参数重新加载
				}
			},
			// 获取标签信息
			getTagInfo(item) {
				return this.tagInfoMap[item.type] || {
					text: this.$t('global.unknown'),
					color: '#999999'
				};
			},

			// 文件大小
			formatSize(size) {
				if (!size) return $t('global.unknownsize');

				if (size >= 1024 * 1024) {
					return (size / (1024 * 1024)).toFixed(1) + 'GB';
				} else if (size >= 1024) {
					return (size / 1024).toFixed(1) + 'MB';
				} else {
					return size + 'KB';
				}
			},
			selectSystem(value) {
				this.selectedSystem = value;
			},
			resetSystem() {
				this.selectedSystem = '';
				this.systemText = this.$t('global.system');
				this.showSystem = false;
				this.getAppList();
			},
			selectType(value) {
				this.selectedType = value;
			},
			resetType() {
				this.selectedType = '';
				this.typeText = this.$t('global.type');
				this.showType = false;
				this.getAppList(false);
			},
			toAppInfo(id) {
				uni.navigateTo({
					url: '/pages/plugins/sy_appbox/info?id=' + id
				});
			},
			// 添加取消排序方法
			cancelOrder() {
				this.showOrder = false;
			},
			shopSearchShop() {
				this.shopPage = 1;
				this.shopGetShopList();
			},
			shopLoadMore() {
				this.shopMoreText = this.$t('global.loading');
				this.isLoad = 1;
				this.shopGetShopList(true);
			},

			shopGetShopTypeList() {
				const that = this;
				that.$Net.request({
					url: that.$API.shopTypeList(),
					data: {
						"limit": 50,
						"page": 1,
						"token": that.token
					},
					header: {
						'Content-Type': 'application/x-www-form-urlencoded'
					},
					method: "get",
					dataType: 'json',
					success: function(res) {
						if (res.data.code == 1) {
							that.shopTypelist = res.data.data;
							const list = res.data.data;
							const sortList = [];
							for (let i in list) {
								if (list[i].parent == 0) {
									sortList.push(list[i]);
								}
							}
							that.shopSortList = sortList;
							if (that.shopSort > 0) {
								for (let s in sortList) {
									if (sortList[s].id == that.shopSort) {
										that.shopSetSort(sortList[s], true);
									}
								}
							}
						}
						that.shopIsLoading = 1;
					},
					fail: function(res) {
						that.shopMoreText = that.$t('common.loadmoretxt');
						that.isLoad = 0;
						that.shopIsLoading = 1;
					}
				});
			},
			shopGetShopList(isPage) {
				const that = this;
				const data = {
					"status": "1",
					"isView": "1"
				};
				if (that.shopSort != 0) {
					data.sort = that.shopSort;
				}
				if (that.shopSubtype != 0) {
					data.subtype = that.shopSubtype;
				}
				let page = that.shopPage;
				if (isPage) {
					page++;
				} else {
					// 非分页加载时重置页数
					that.shopPage = 1;
					page = 1;
				}
				that.$Net.request({
					url: that.$API.shopList(),
					data: {
						"searchParams": JSON.stringify(that.$API.removeObjectEmptyKey(data)),
						"searchKey": that.shopSearchText,
						"limit": 6,
						"page": page,
					},
					header: {
						'Content-Type': 'application/x-www-form-urlencoded'
					},
					method: "get",
					dataType: 'json',
					success: function(res) {
						that.isLoad = 0;
						that.shopMoreText = that.$t('common.loadmoretxt');
						if (res.data.code == 1) {
							const list = res.data.data;
							if (list.length == 0) {
								that.shopMoreText = that.$t('common.nomoredata');
							}
							if (isPage) {
								if (list.length > 0) {
									that.shopPage++;
									that.shopList = that.shopList.concat(list);
								}
							} else {
								that.shopList = list;
							}
						}
						that.shopIsLoading = 1;
					},
					fail: function(res) {
						that.shopMoreText = that.$t('common.loadmoretxt');
						that.isLoad = 0;
						that.shopIsLoading = 1;
					}
				});
			},
			openSpaceTypePicker() {
				this.showSpaceTypePicker = true;
			},
			confirmSpaceType(e) {
				const selected = this.spaceTypeOptions[e[0]];
				if (selected) {
					this.spaceDataType = selected.value;
					this.spaceTypeText = selected.label;
					this.spaceLoad = false;
					this.page = 1;
					this.spaceList = [];
					this.getSpaceList(false);
				}
				this.showSpaceTypePicker = false;
			},
			// 商城筛选相关方法
			showShopFilter() {
				// 初始化临时变量为当前选中值
				this.tempShopSort = this.shopSort;
				this.tempShopSortText = this.shopSortText;
				this.tempShopSubtype = this.shopSubtype;
				this.tempShopSubtypeText = this.shopSubtypeText;
				// 只有当前已选择了具体大类时才显示小类
				if (this.shopSort > 0) {
					this.updateTempSubtypeList();
				} else {
					this.tempShopSubtypeList = [];
				}
				this.shopFilterShow = true;
			},
			selectTempShopSort(id, name = '') {
				this.tempShopSort = id;
				this.tempShopSortText = name;
				// 重置小类选择
				this.tempShopSubtype = 0;
				this.tempShopSubtypeText = "";
				// 只有选择了具体大类时才更新小类列表
				if (id > 0) {
					this.updateTempSubtypeList();
				} else {
					// 选择"全部大类"时清空小类列表
					this.tempShopSubtypeList = [];
				}
			},
			selectTempShopSubtype(id, name = '') {
				this.tempShopSubtype = id;
				this.tempShopSubtypeText = name;
			},
			updateTempSubtypeList() {
				const list = this.shopTypelist;
				const subtypeList = [];
				for (let i in list) {
					if (list[i].parent == this.tempShopSort) {
						subtypeList.push(list[i]);
					}
				}
				this.tempShopSubtypeList = subtypeList;
			},
			resetShopFilter() {
				this.tempShopSort = 0;
				this.tempShopSortText = "";
				this.tempShopSubtype = 0;
				this.tempShopSubtypeText = "";
				this.tempShopSubtypeList = [];
			},
			cancelShopFilter() {
				this.shopFilterShow = false;
			},
			confirmShopFilter() {
				// 应用筛选条件
				this.shopSort = this.tempShopSort;
				this.shopSortText = this.tempShopSortText;
				this.shopSubtype = this.tempShopSubtype;
				this.shopSubtypeText = this.tempShopSubtypeText;
				this.shopSubtypeList = this.tempShopSubtypeList;
				
				// 重置页数并重新获取数据
				this.shopPage = 1;
				this.shopGetShopList();
				
				this.shopFilterShow = false;
			},
			
			// 添加缺失的shopSetSort函数
			shopSetSort(data, noSub) {
				const that = this;
				
				if (data == null) {
					that.shopSort = 0;
					that.shopSortText = "";
					that.shopSubtype = 0;
					that.shopSubtypeText = "";
					that.shopPage = 1;
					that.shopGetShopList();
					return false;
				}
				that.shopSort = data.id;
				that.shopSortText = data.name;
				
				if (that.shopSort != 0) {
					const list = that.shopTypelist;
					const subtypeList = [];
					for (let i in list) {
						if (list[i].parent == that.shopSort) {
							subtypeList.push(list[i]);
						}
					}
					that.shopSubtypeList = subtypeList;
					that.shopSubtype = 0;
					that.shopSubtypeText = "";
				}
				that.shopGetShopList();
			},
			formatTopicCount(count) {
				if (!count || count === 0) {
					return '0';
				}
				if (count < 1000) {
					return count.toString();
				} else if (count < 10000) {
					return (count / 1000).toFixed(1) + 'k';
				} else {
					return (count / 10000).toFixed(1) + 'w';
				}
			},
			checkAndRefreshData() {
				var that = this;
				// 检查动态发布刷新标记
				var needRefreshSpace = localStorage.getItem('needRefreshSpace');
				if (needRefreshSpace === 'true') {
					localStorage.removeItem('needRefreshSpace');
					// 刷新动态相关数据
					that.getSpaceList && that.getSpaceList(false);
					that.getSpaceshowList && that.getSpaceshowList();
				}
				// 检查发现页刷新标记
				var needRefreshFind = localStorage.getItem('needRefreshFind');
				if (needRefreshFind === 'true') {
					localStorage.removeItem('needRefreshFind');
					// 刷新发现页数据
					that.loadingFun && that.loadingFun();
				}
				// 检查首页刷新标记（如果需要联动首页）
				var needRefreshHome = localStorage.getItem('needRefreshHome');
				if (needRefreshHome === 'true') {
					localStorage.removeItem('needRefreshHome');
					// 可选：如需联动首页刷新，可触发事件或其他逻辑
				}
			},
		},
		// #ifdef H5 || MP
		components: {
			waves
		},
		// #endif
	}
</script>

<style lang="scss" scoped>
	@import "@/static/styles/home.scss";

	body {
		background-color: #f6f6f6;
	}

	.user-rz {
		position: relative;
		display: inline-block;
	}

	.user-rz-icon {
		position: absolute;
		right: -6upx;
		bottom: -4upx;
		width: 44upx;
		height: 44upx;
	}

	.zhuce {
		background: #fff;
		border: 2upx solid #3cc9a4;
		color: #3cc9a4;
	}

	.data-box-2 {
		padding: 0;
		margin: 20upx 20upx;
		border-radius: 20upx;
		box-shadow: 0 0 50upx 0 rgba(0, 0, 0, .04);
	}
	.square-text{
		border-radius: 20px;
	}
	.data-box-2 .cu-bar {
		border-radius: 20upx;
	}
	.dark .bg-white {
		background-color: #1c1c1c !important;
	}
	.data-box-2-banner {
		padding: 0;
		margin: 20upx 0;
		border-radius: 20upx;
		box-shadow: 0 0 50upx 0 rgba(0, 0, 0, .04);
	}

	.uni-swiper-dot.uni-swiper-dot-active {
		background-color: #00bcd4 !important;
		opacity: 0.8;
	}

	.uni-swiper-dot {
		border-radius: 50upx !important;
	}

	.uni-swiper-slides swiper-item {
		padding: 0 0;
		box-sizing: border-box;
	}

	.screen-swiper {
		min-height: 300upx;
	}

	.u-wrap {
		display: flex;
		flex-direction: column;
		overflow: hidden;
	}

	.u-search-box {
		padding: 18rpx 30rpx;
	}

	.u-menu-wrap {
		flex: 1;
		display: flex;
		overflow: hidden;
	}

	.u-search-inner {
		background-color: rgb(234, 234, 234);
		border-radius: 100rpx;
		display: flex;
		align-items: center;
		padding: 10rpx 16rpx;
	}

	.u-search-text {
		font-size: 26rpx;
		color: $u-tips-color;
		margin-left: 10rpx;
	}

	.u-tab-view {
		width: 200rpx;
		height: 100%;
	}

	.u-tab-item {
		height: 110rpx; // 保持固定高度
		background: #f6f6f6;
		box-sizing: border-box;
		display: flex;
		align-items: center;
		justify-content: center;
		font-size: 26rpx;
		color: #444;
		font-weight: 400;
		line-height: 1;
	}

	.u-tab-item-active {
		position: relative;
		color: #000;
		font-size: 30rpx;
		font-weight: 600;
		background: #fff;
	}

	.u-tab-item-active::before {
		content: "";
		position: absolute;
		border-left: 4px solid #3cc9a4;
		height: 32rpx;
		left: 0;
		top: 39rpx;
		border-radius: 50rpx;
	}

	.u-tab-view {
		height: 100%;
		overflow: auto;
	}

	.right-box {
		background-color: rgb(250, 250, 250);
		overflow: auto;
	}
	.icon-grid-container {
	  width: 100%;
	  display: flex;
	  justify-content: center;
	  padding: 10rpx 0;
	}

	.icon-grid {
	  display: flex;
	  flex-wrap: wrap;
	  justify-content: flex-start;
	  width: 100%;
	  max-width: 750rpx;
	}

	.icon-item {
	  width: calc(100% / 5);
	  box-sizing: border-box;
	  padding: 10rpx;
	}

	.page-view {
		padding: 16rpx;
	}

	.class-item {
		margin-bottom: 30rpx;
		background-color: #fff;
		padding: 16rpx;
		border-radius: 16rpx;
	}

	.item-title {
		font-size: 26rpx;
		color: $u-main-color;
		font-weight: bold;
	}

	.item-menu-name {
		font-weight: normal;
		font-size: 24rpx;
		color: $u-main-color;
	}

	.thumb-box {
		width: 33.333333%;
		display: flex;
		align-items: center;
		justify-content: center;
		flex-direction: column;
		margin-top: 20rpx;
	}

	.item-menu-image {
		width: 120rpx;
		height: 120rpx;
	}
	.icon5__item--icon {
		width: 62rpx;
		height: 62rpx;
		margin-bottom: 10rpx;
	}
	.icon5__item--icon-2 {
		width: 90rpx;
		height: 90rpx;
		margin-bottom: 10rpx;
	}
	.app-box {
		display: flex;
		justify-content: space-between;
		align-items: center;
		margin-bottom: 10rpx;
	}

	.app-box-body {
		flex: 1;
		display: flex;
		margin-right: 20rpx;
		min-width: 0; // 防止flex子元素溢出
		align-items: center;
	}

	.app-box-logo {
		width: 110rpx;
		height: 110rpx;
		flex-shrink: 0; // 防止图片缩小
	}

	.app-box-content {
		flex: 1;
		margin-left: 20rpx;
		min-width: 0; // 防止flex子元素溢出
	}

	.app-box-title {
		font-size: 30rpx;
		font-weight: bold;
		margin-bottom: 6rpx;
		width: 250rpx;
	}

	.text-cut {
		text-overflow: ellipsis;
		white-space: nowrap;
		overflow: hidden;
	}

	.app-box-info {
		font-size: 26rpx;
		color: #666;
		margin-bottom: 6rpx;

		text {
			margin-right: 10rpx;
		}
	}

	.app-box-tags {
		display: flex;
		flex-wrap: wrap;
		align-items: center;
		gap: 8rpx;
	}

	.app-tag {
		padding: 4rpx 12rpx;
		border-radius: 8rpx;
		color: #ffffff;
		font-size: 24rpx;
	}

	.app-category-tag {
		padding: 4rpx 12rpx;
		border-radius: 8rpx;
		background-color: #f5f5f5;
		color: #666666;
		font-size: 24rpx;
	}

	.app-box-down {
		background-color: #3cc9a4;
		color: #fff;
		padding: 10rpx 30rpx;
		border-radius: 100rpx;
		white-space: nowrap; // 防止文字换行
		flex-shrink: 0; // 防止按钮缩小
	}

	.nav {
		white-space: nowrap;
		padding: 0 30rpx;
		height: 90rpx;
		border-bottom: 1px solid #f1f1f1;

		.cu-item {
			height: 90rpx;
			display: inline-block;
			line-height: 90rpx;
			margin: 0 30rpx;
			padding: 0 20rpx;

			&.cur {
				border-bottom: 4rpx solid #3cc9a4;
			}
		}
	}

	.app-box {
		margin-bottom: 20rpx;

		.app-box-tags {
			display: flex;
			flex-wrap: wrap;
			align-items: center;
			color: #666;
			font-size: 26rpx;

			.app-tag {
				padding: 4rpx 8rpx;
				border-radius: 8rpx;
				color: #ffffff;
				font-size: 20rpx;
			}

			.app-category-tag {
				padding: 4rpx 12rpx;
				border-radius: 8rpx;
				background-color: #f5f5f5;
				color: #666666;
				margin-right: 12rpx;
				font-size: 24rpx;
			}
		}
	}
	.des-info{
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
		max-width: 180rpx;
	}
	/* 筛选栏样式 */
	.filter-bar {
		display: flex;
		padding: 20rpx;
		border-bottom: 1px solid #f5f5f5;
	}

	.filter-item {
		flex: 1;
		text-align: center;
		font-size: 28rpx;
		color: #333;
		justify-content: flex-end;
	}

	.filter-item .cuIcon-unfold {
		margin-left: 4rpx;
		font-size: 24rpx;
		color: #999;
	}

	/* 筛选弹窗样式 */
	.filter-popup {
		background: #fff;
		padding: 30rpx;
		border-radius: 20rpx 20rpx 0 0;
	}

	.filter-title {
		font-size: 32rpx;
		font-weight: bold;
		margin-bottom: 30rpx;
	}

	.filter-options {
		display: flex;
		flex-wrap: wrap;
	}

	.filter-option {
		width: 160rpx;
		height: 60rpx;
		line-height: 60rpx;
		text-align: center;
		border: 1px solid #eee;
		border-radius: 30rpx;
		margin: 0 20rpx 20rpx 0;
		font-size: 28rpx;
	}

	.filter-option.active {
		background: #3cc9a4;
		color: #fff;
		border-color: #3cc9a4;
	}

	.filter-buttons {
		display: flex;
		margin-top: 40rpx;
	}

	.btn-reset,
	.btn-confirm {
		flex: 1;
		height: 80rpx;
		line-height: 80rpx;
		text-align: center;
		border-radius: 40rpx;
		margin: 0 20rpx;
		font-size: 30rpx;
	}

	.btn-reset {
		background: #f5f5f5;
		color: #666;
	}

	.btn-confirm {
		background: #3cc9a4;
		color: #fff;
	}

	.text-title-1 {
		overflow: hidden;
		display: -webkit-box;
		-webkit-line-clamp: 1;
		-webkit-box-orient: vertical;
	}

	/* 添加加载动画相关样式 */
	.loading-container {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		padding: 40rpx 0;

		.loading-text {
			font-size: 26rpx;
			color: #909399;
			margin-top: 20rpx;
		}
	}

	.loading-more {
		display: flex;
		align-items: center;
		justify-content: center;
		padding: 30rpx 0;

		.loading-more-text {
			font-size: 24rpx;
			color: #909399;
		}
	}

	.menu-scroll-view {
		height: 100%;
		overflow: auto;
	}

	.square-data-type-picker {
		display: flex;
		justify-content: flex-end;
		align-items: center;
		padding: 20rpx 30rpx 20rpx 0;
	}
	.filter-item {
		display: flex;
		align-items: center;
		font-size: 28rpx;
		color: #333;
		cursor: pointer;
	}
	.filter-item .cuIcon-unfold {
		margin-left: 8rpx;
		font-size: 24rpx;
		color: #999;
	}

	/* 商城筛选相关样式 */
	.search-bar {
		display: flex;
		align-items: center;
		padding: 20rpx 30rpx 30rpx 0;
	}

	.search-form {
		flex: 1;
		margin-right: 20rpx;
	}

	.filter-btn {
		display: flex;
		align-items: center;
		justify-content: center;
		min-width: 120rpx;
		height: 60rpx;
		background: #f8f8f8;
		border-radius: 30rpx;
		padding: 0 20rpx;
	}

	.filter-text {
		font-size: 26rpx;
		color: #666;
		margin-left: 8rpx;
	}

	.shop-filter-popup {
		background: #fff;
		border-radius: 20rpx 20rpx 0 0;
		padding: 30rpx;
		max-height: 80vh;
		overflow-y: auto;
	}

	.filter-header {
		display: flex;
		justify-content: space-between;
		align-items: center;
		padding-bottom: 30rpx;
		border-bottom: 1px solid #f0f0f0;
		margin-bottom: 30rpx;
	}

	.filter-title {
		font-size: 32rpx;
		font-weight: bold;
		color: #333;
	}

	.filter-reset {
		font-size: 28rpx;
		color: #999;
	}

	.filter-section {
		margin-bottom: 40rpx;
		transition: all 0.3s ease-in-out;
	}

	.filter-section-title {
		font-size: 28rpx;
		font-weight: bold;
		color: #333;
		margin-bottom: 20rpx;
	}

	.filter-tip {
		display: flex;
		align-items: center;
		justify-content: center;
		padding: 30rpx 20rpx;
		background: #f8f9fa;
		border-radius: 16rpx;
		border: 1px dashed #ddd;
	}

	.filter-tip-text {
		font-size: 26rpx;
		color: #999;
		margin-left: 10rpx;
	}

	.filter-options {
		display: flex;
		flex-wrap: wrap;
		gap: 20rpx;
		justify-content: flex-start;
		align-items: flex-start;
	}

	.filter-option {
		padding: 0rpx 24rpx;
		background: #f8f8f8;
		border-radius: 30rpx;
		font-size: 26rpx;
		color: #666;
		border: 1px solid transparent;
		transition: all 0.3s;
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
		min-height: 48rpx;
		display: flex;
		align-items: center;
		justify-content: center;
		text-align: center;
		max-width: calc((100vw - 140rpx) / 3);
		min-width: 80rpx;
		box-sizing: border-box;
		flex-shrink: 0;
	}
	
	/* 针对较小屏幕的优化 */
	@media screen and (max-width: 750rpx) {
		.filter-option {
			max-width: calc((100vw - 120rpx) / 2);
			font-size: 24rpx;
		}
	}

	.filter-option.active {
		background: #e8fff4;
		color: #3cc9a4;
		border-color: #3cc9a4;
	}

	.filter-footer {
		display: flex;
		gap: 20rpx;
		margin-top: 40rpx;
		padding-top: 30rpx;
		border-top: 1px solid #f0f0f0;
	}

	.filter-btn-cancel,
	.filter-btn-confirm {
		flex: 1;
		height: 80rpx;
		line-height: 80rpx;
		text-align: center;
		border-radius: 40rpx;
		font-size: 30rpx;
	}

	.filter-btn-cancel {
		background: #f8f8f8;
		color: #666;
	}

	.filter-btn-confirm {
		background: #3cc9a4;
		color: #fff;
	}

	/* 活跃用户卡片样式 */
	.active-users-container {
		padding: 0 20rpx 30rpx 20rpx;
	}

	.active-users-scroll {
		white-space: nowrap;
	}

	.active-users-list {
		display: flex;
		gap: 24rpx;
		padding: 20rpx 10rpx;
	}

	.active-user-card {
		display: flex;
		flex-direction: column;
		align-items: flex-start;
		width: 260rpx;
		min-width: 260rpx;
		padding: 50rpx 40rpx 50rpx 40rpx;
		border-radius: 24rpx;
		background-color: #f5f5f5;
		transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
		position: relative;
		overflow: hidden;
	}

	.active-user-card::before {
		content: '';
		position: absolute;
		top: 0;
		left: 0;
		right: 0;
		height: 4rpx;
		opacity: 0;
		transition: opacity 0.3s ease;
	}

	.active-user-card:active {
		transform: translateY(4rpx) scale(0.96);
		box-shadow: 0 4rpx 16rpx rgba(60, 201, 164, 0.16), 0 1rpx 4rpx rgba(0, 0, 0, 0.12);
	}

	.active-user-card:active::before {
		opacity: 1;
	}

	.user-avatar-container {
		position: relative;
		margin-bottom: 20rpx;
	}

	.user-avatar {
		width: 120rpx;
		height: 120rpx;
		border-radius: 64rpx;
		background-size: cover;
		background-position: center;
		transition: transform 0.3s ease;
	}

	.active-user-card:active .user-avatar {
		transform: scale(0.95);
	}

	.user-rz-icon-active {
		position: absolute;
		right: -6rpx;
		bottom: -6rpx;
		width: 44rpx;
		height: 44rpx;
		border-radius: 22rpx;
		box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.2);
	}

	.user-name {
		font-size: 30rpx;
		font-weight: 600;
		color: #333;
		margin-bottom: 10rpx;
		text-align: center;
		max-width: 200rpx;
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
		line-height: 1.2;
	}

	.vip-name {
		color: #ff6c3e;
		font-weight: 700;
		text-shadow: 0 1rpx 2rpx rgba(255, 108, 62, 0.2);
	}

	.user-intro {
		font-size: 22rpx;
		color: #666;
		text-align: center;
		line-height: 1.5;
		max-width: 200rpx;
		overflow: hidden;
		display: -webkit-box;
		-webkit-line-clamp: 1;
		text-overflow: ellipsis;
		-webkit-box-orient: vertical;
		word-break: break-all;
		opacity: 0.9;
	}

	.no-active-users {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		padding: 60rpx 20rpx;
		color: #999;
	}

	.no-active-users .cuIcon-people {
		font-size: 80rpx;
		margin-bottom: 20rpx;
		opacity: 0.5;
	}

	.no-users-text {
		font-size: 28rpx;
		color: #999;
		opacity: 0.7;
	}

	/* 推荐话题卡片样式 */
	.topic-cards-container {
		padding: 20rpx;
		background: #ffffff;
	}

	.topic-row {
		display: flex;
		gap: 20rpx;
	}

	.topic-card {
		flex: 1;
		display: flex;
		align-items: center;
		background: #ffffff;
		padding: 20rpx;
		transition: all 0.3s ease;
	}

	.topic-card:active {
		transform: scale(0.98);
		opacity: 0.8;
	}

	.topic-image-container {
		flex-shrink: 0;
		width: 100rpx;
		height: 100rpx;
		border-radius: 20rpx;
		overflow: hidden;
		margin-right: 20rpx;
		background: #f8f9fa;
	}

	.topic-image {
		width: 100%;
		height: 100%;
		object-fit: cover;
	}

	.topic-content {
		flex: 1;
		display: flex;
		flex-direction: column;
		justify-content: center;
		min-width: 0;
	}

	.topic-name {
		font-size: 28rpx;
		font-weight: 600;
		color: #333;
		margin-bottom: 8rpx;
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
		line-height: 1.2;
	}

	.topic-count {
		display: flex;
		align-items: baseline;
		gap: 4rpx;
	}


	.topic-count-text {
		font-size: 22rpx;
		color: #999;
	}
</style>